<script>
$('#suppliers').change(function(){
	var paymethod = $('#suppliers option:selected').data('paymethod');
	var deliverymode = $('#suppliers option:selected').data('deliverymode');
	$('#paymethod').val(paymethod);
	$('#deliverymode').val(deliverymode);
});

$('#confirm').click(function(){
	$.post('{{ urlfor "ErpEntryController.DeleteTemp" }}', function(res){
		if(res.code == 0) {
			$.post('{{ urlfor "ErpEntryController.Save" }}', $('#formDoSubmit-select').serialize(), function(res){
				if(res.code == 0) {
					parent.SelectSuppliersRollBack(res.data);
					return true;
				} else {
					layer.msg(res.msg);	
				}
			}, 'json');
			return false;
		}
		layer.msg('未知错误');	
	}, 'json');
});
</script>